﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BoxWeather.ascx.cs" Inherits="GUI.Controls.Shared.BoxWeather" %>
<div class="thoitiet" id="weather">
    <div class="caption">
    </div>
    <div style="text-align: center; font-size: small;">
        <select id="cbSelect" name="cbSelect" style="display: none">
            <option value="T.P Hà Nội">Hà Nội</option>
            <option value="Đà Nẵng">Đà Nẵng</option>
            <option value="T.P Hồ Chí Minh">TP.HCM</option>
            <option value="Hải Phòng">Hải Phòng</option>
            <option value="Nha Trang">Nha Trang</option>
            <option value="Pleiku">Pleiku</option>
            <option value="Sơn La">Sơn La</option>
            <option value="Vinh">Vinh</option>
        </select>
    </div>
    <div id="divThoiTiet" class="info" style="padding-top: 2px;">
        <div class="cloudy">
            <div class="cloudy" id="divWeatherImage">
            </div>
        </div>
        <div class="temp">
            <div class="temp" id="divWeather">
            </div>
        </div>
    </div>
</div>
<script language="javascript" type="text/javascript">
    try {
        var channelweather = new channelvnWather('channelweather');
        channelweather.LoadDataWeather();
        $('#cbSelect').selectbox();
    } catch (e) { };

    (function () {
        var cookieIsExisted = false;
        var index = 0;
        var userDefinedLocationCookieName = "fUserSohaLocation";
        var userSohaLocation = getCookie(userDefinedLocationCookieName);
        if (userSohaLocation && userSohaLocation != '') {
            index = userSohaLocation;
            cookieIsExisted = true;
        } else {
            var sohaLocation = getCookie("__R");
            if (sohaLocation && sohaLocation != '') {
                switch (sohaLocation) {
                    case "1":
                        {
                            index = 0;
                            break;
                        }
                    case "2":
                        {
                            index = 1;
                            break;
                        }
                    case "3":
                        {
                            index = 2;
                            break;
                        }
                    default:
                        {
                            index = 0;
                            break;
                        }
                }
                cookieIsExisted = true;
            }
        }
        var lis = $('#cbSelect_container ul li');
        lis.each(function () {
            $(this).click(function () {
                setCookie(userDefinedLocationCookieName, lis.index($(this)), 30);
            });
        });
        if (cookieIsExisted == true) {
            lis.eq(index).click();
        }

    })();
</script>
